//
//  MXDescribeTableViewCell.m
//  MXの衣柜
//
//  Created by 马霄 on 15/8/23.
//  Copyright (c) 2015年 霄 马. All rights reserved.
//

#import "MXDescribeTableViewCell.h"


@interface MXDescribeTableViewCell ()
@property (nonatomic, retain) UILabel *desLabel;
@end
@implementation MXDescribeTableViewCell
- (void)dealloc
{
    [_content release];
    [_desLabel release];
    [super dealloc];
}


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.desLabel = [[[UILabel alloc] init] autorelease];
        self.desLabel.numberOfLines = 0;
        [self.contentView addSubview:self.desLabel];
    }
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    CGFloat desLabelX = 0;
    CGFloat desLabelY = 0;
    CGFloat desLabelW = self.contentView.frame.size.width;
    CGFloat desLabelH = self.contentView.frame.size.height;
    self.desLabel.frame = CGRectMake(desLabelX, desLabelY, desLabelW, desLabelH);
}

-(void)setContent:(NSString *)content
{
    
    NSMutableAttributedString *recommendStr = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"  %@", content]];
    [recommendStr addAttribute:NSForegroundColorAttributeName value:[UIColor blueColor] range:NSMakeRange(2, 2)];
    [recommendStr addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:22] range:NSMakeRange(2, 2)];
    
    self.desLabel.attributedText = recommendStr;
    
//    self.desLabel.text = content;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
